package com.mj.Queue;

import com.mj.linkedlist.LinkedList;
import com.mj.linkedlist.List;

/**
 * @Author: LDeng
 * @Date: 2021-02-24 9:45
 */
public class Queue<E> {
    //队列频繁向头尾修改元素， 所以使用双向链表 性能更好
    private List<E> list=new LinkedList<>();


    public int size(){
        return list.size();
    }

    public boolean isEmpty(){
        return list.isEmpty();
    }

    public void clear(){
        list.clear();
    }

    public void enQueue(E element){
        list.add(element);
    }

    public E deQueue(){

        return list.remove(0);
    }

    public E front(){

        return list.get(0);
    }
}
